// 获取格式为16:25的时间
export function getCurrentTime() {
    const now = new Date();
    const hours = now.getHours().toString().padStart(2, '0'); // 获取小时并补零
    const minutes = now.getMinutes().toString().padStart(2, '0'); // 获取分钟并补零
    return `${hours}:${minutes}`;
}

// 获取一段随机字符串
export function generateRandomString(length: number) {
    const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    let randomString = "";
    length = length ? length : 5
    for (let i = 0; i < length; i++) {
        const randomIndex = Math.floor(Math.random() * charset.length);
        randomString += charset.charAt(randomIndex);
    }

    return randomString;
}